Ext.define('App.management.pm.view.PmProjectReportFrame', {
    extend: 'App.management.pm.view.PmBaseFrame',
    alias: ['widget.PmProjectReportFrame'],
    requires: ['App.report.project.view.ProjectReportList'],
    listeners: {
        afterrender: function () {
            var me = this;
            me.loadReport();
        }
    },
    loadReport: function () {
        var me = this;
        if (Ext.isEmpty(app.project)) {
            return;
        }
        me.mask('加载报表...');
        Ext.Ajax.request({
            url: 'report_configuration/query_project_report_configuration',
            params: {projectId: app.project.id},
            success: function (resp) {
                var rcs = resp.result.data;
                if (Ext.isArray(rcs)) {
                    Ext.Array.each(rcs, function (item) {
                        var report = Ext.create('App.report.project.view.ProjectReportList', {
                            title: item.name,
                            projectId: app.project.id,
                            reportConfiguration: item
                        })
                        me.addTabitem(report)
                    })
                }
                me.setActiveTab(0)
                me.unmask();
            },
            failure: function () {
                me.unmask();
            }
        });
    },
    tabitems: []
})